<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 5.1.1">
  <link rel="apple-touch-icon" sizes="180x180" href="/hexo/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/hexo/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/hexo/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/hexo/images/logo.svg" color="#222">

<link rel="stylesheet" href="/hexo/css/main.css">


<link rel="stylesheet" href="/hexo/lib/font-awesome/css/all.min.css">

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"youchen12138.gitee.io","root":"/hexo/","scheme":"Gemini","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":false,"show_result":false,"style":null},"back2top":{"enable":true,"sidebar":false,"scrollpercent":false},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":false,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}}};
  </script>

  <meta name="description" content="文字样式属性   文字样式 英文    字体 font-family   文字大小 font-size   文字颜色 color   文字粗细 font-weight   文字样式 font-style   font-family字体属性font-family属性值：具体字体名，字体集 字体集：  Serif  Sans-serif  Monospace  Cursive  Fantasy   f">
<meta property="og:type" content="article">
<meta property="og:title" content="CSS基础知识点--CSS字体样式（font）">
<meta property="og:url" content="https://youchen12138.gitee.io/hexo/2020/08/26/CSS%E5%9F%BA%E7%A1%80%E7%9F%A5%E8%AF%86%E7%82%B9-CSS%E5%AD%97%E4%BD%93%E6%A0%B7%E5%BC%8F%EF%BC%88font%EF%BC%89/index.html">
<meta property="og:site_name" content="幽辰的博客">
<meta property="og:description" content="文字样式属性   文字样式 英文    字体 font-family   文字大小 font-size   文字颜色 color   文字粗细 font-weight   文字样式 font-style   font-family字体属性font-family属性值：具体字体名，字体集 字体集：  Serif  Sans-serif  Monospace  Cursive  Fantasy   f">
<meta property="og:locale" content="en_US">
<meta property="article:published_time" content="2020-08-26T06:32:06.000Z">
<meta property="article:modified_time" content="2020-08-26T06:32:31.627Z">
<meta property="article:author" content="幽辰">
<meta property="article:tag" content="CSS">
<meta name="twitter:card" content="summary">

<link rel="canonical" href="https://youchen12138.gitee.io/hexo/2020/08/26/CSS%E5%9F%BA%E7%A1%80%E7%9F%A5%E8%AF%86%E7%82%B9-CSS%E5%AD%97%E4%BD%93%E6%A0%B7%E5%BC%8F%EF%BC%88font%EF%BC%89/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'en'
  };
</script>

  <title>CSS基础知识点--CSS字体样式（font） | 幽辰的博客</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="Toggle navigation bar">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/hexo/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">幽辰的博客</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
    </div>
  </div>
</div>




<nav class="site-nav">
  <ul id="menu" class="main-menu menu">
        <li class="menu-item menu-item-home">

    <a href="/hexo/" rel="section"><i class="fa fa-home fa-fw"></i>Home</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/hexo/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>Tags<span class="badge">23</span></a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/hexo/categories/" rel="section"><i class="fa fa-th fa-fw"></i>Categories<span class="badge">14</span></a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/hexo/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>Archives<span class="badge">127</span></a>

  </li>
  </ul>
</nav>




</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content post posts-expand">
            

    
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="en">
    <link itemprop="mainEntityOfPage" href="https://youchen12138.gitee.io/hexo/2020/08/26/CSS%E5%9F%BA%E7%A1%80%E7%9F%A5%E8%AF%86%E7%82%B9-CSS%E5%AD%97%E4%BD%93%E6%A0%B7%E5%BC%8F%EF%BC%88font%EF%BC%89/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/hexo/images/avatar.jpg">
      <meta itemprop="name" content="幽辰">
      <meta itemprop="description" content="">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="幽辰的博客">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          CSS基础知识点--CSS字体样式（font）
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">Posted on</span>
              

              <time title="Created: 2020-08-26 14:32:06 / Modified: 14:32:31" itemprop="dateCreated datePublished" datetime="2020-08-26T14:32:06+08:00">2020-08-26</time>
            </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">In</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/hexo/categories/CSS/" itemprop="url" rel="index"><span itemprop="name">CSS</span></a>
                </span>
            </span>

          

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <h2 id="文字样式属性"><a href="#文字样式属性" class="headerlink" title="文字样式属性"></a>文字样式属性</h2><table>
<thead>
<tr>
<th>文字样式</th>
<th>英文</th>
</tr>
</thead>
<tbody><tr>
<td>字体</td>
<td>font-family</td>
</tr>
<tr>
<td>文字大小</td>
<td>font-size</td>
</tr>
<tr>
<td>文字颜色</td>
<td>color</td>
</tr>
<tr>
<td>文字粗细</td>
<td>font-weight</td>
</tr>
<tr>
<td>文字样式</td>
<td>font-style</td>
</tr>
</tbody></table>
<h2 id="font-family字体属性"><a href="#font-family字体属性" class="headerlink" title="font-family字体属性"></a>font-family字体属性</h2><p>font-family属性值：具体字体名，字体集</p>
<p>字体集：</p>
<ul>
<li><p>Serif</p>
</li>
<li><p>Sans-serif</p>
</li>
<li><p>Monospace</p>
</li>
<li><p>Cursive</p>
</li>
<li><p>Fantasy</p>
</li>
</ul>
<h2 id="font-size文字大小"><a href="#font-size文字大小" class="headerlink" title="font-size文字大小"></a>font-size文字大小</h2><blockquote>
<p>font-size: 绝对单位 | 相对单位</p>
</blockquote>
<h3 id="绝对单位"><a href="#绝对单位" class="headerlink" title="绝对单位"></a>绝对单位</h3><table>
<thead>
<tr>
<th>属性值</th>
<th>说明</th>
</tr>
</thead>
<tbody><tr>
<td>in</td>
<td>Inch，英寸  1英寸=2.54厘米</td>
</tr>
<tr>
<td>cm</td>
<td>厘米  1厘米=0.394英寸</td>
</tr>
<tr>
<td>mm</td>
<td>毫米  1毫米=0.1厘米</td>
</tr>
<tr>
<td>pt</td>
<td>磅，印刷的点数  72磅=1英寸</td>
</tr>
<tr>
<td>pc</td>
<td>Pica，1pc=12pt</td>
</tr>
</tbody></table>
<table>
<thead>
<tr>
<th>属性值</th>
<th>CSS2缩放系数1.2</th>
</tr>
</thead>
<tbody><tr>
<td>xx-small</td>
<td>9px</td>
</tr>
<tr>
<td>x-small</td>
<td>11px</td>
</tr>
<tr>
<td>small</td>
<td>13px</td>
</tr>
<tr>
<td>medium（浏览器默认大小）</td>
<td>16px</td>
</tr>
<tr>
<td>large</td>
<td>19px</td>
</tr>
<tr>
<td>x-large</td>
<td>23px</td>
</tr>
<tr>
<td>xx-large</td>
<td>28px</td>
</tr>
</tbody></table>
<p>绝对大小，不能随浏览器分辨率或父元素大小的改变而改变</p>
<h3 id="相对单位"><a href="#相对单位" class="headerlink" title="相对单位"></a>相对单位</h3><ul>
<li><p>px 像素</p>
</li>
<li><p>em / %</p>
</li>
</ul>
<p>移动端一般不用px</p>
<h2 id="color文字颜色"><a href="#color文字颜色" class="headerlink" title="color文字颜色"></a>color文字颜色</h2><p>定义元素内文字颜色</p>
<p>语法：</p>
<blockquote>
<p>color：颜色名 | 十六进制 | RGB</p>
</blockquote>
<h2 id="font-weight文字粗细"><a href="#font-weight文字粗细" class="headerlink" title="font-weight文字粗细"></a>font-weight文字粗细</h2><p>为元素内文字设置粗细</p>
<p>语法：</p>
<blockquote>
<p>font-weight: normal | bold | bolder | lighter | 100~900</p>
</blockquote>
<p>说明：</p>
<p>默认值：normal</p>
<p>400等同于normal，而700等同于bold</p>
<h2 id="font-style文字样式"><a href="#font-style文字样式" class="headerlink" title="font-style文字样式"></a>font-style文字样式</h2><p>为元素内文字设置样式</p>
<p>语法：</p>
<blockquote>
<p>font-style: normal | italic | oblique</p>
</blockquote>
<h2 id="font-variant字体变形"><a href="#font-variant字体变形" class="headerlink" title="font-variant字体变形"></a>font-variant字体变形</h2><p>设置元素中文本为小型大写字母</p>
<p>语法：</p>
<blockquote>
<p>font-variant：normal | small-caps</p>
</blockquote>
<h2 id="font属性简写"><a href="#font属性简写" class="headerlink" title="font属性简写"></a>font属性简写</h2><p>语法：</p>
<blockquote>
<p>font：font-style font-variant font-weight font-size/line-height font-family</p>
</blockquote>
<p>说明：</p>
<ul>
<li><p>值之间空格隔开</p>
</li>
<li><p>注意书写顺序</p>
</li>
<li><p>如果font-family有多个值，用逗号分隔开</p>
</li>
</ul>
<p>注意：</p>
<ol>
<li><p>同时设置font-size和font-family，属性才起作用</p>
</li>
<li><p>前三者顺序是任意的</p>
</li>
<li><p>后两者顺序是font-size在前，font-family在后</p>
</li>
<li><p>如果有前面三者任意一种存在，必须在font-size和font-family前面</p>
</li>
</ol>

    </div>

    
    
    

      <footer class="post-footer">
          <div class="post-tags">
              <a href="/hexo/tags/CSS/" rel="tag"># CSS</a>
          </div>

        


        
    <div class="post-nav">
      <div class="post-nav-item">
    <a href="/hexo/2020/08/26/CSS%E5%9F%BA%E7%A1%80%E7%9F%A5%E8%AF%86%E7%82%B9-float%E6%B5%AE%E5%8A%A8/" rel="prev" title="CSS基础知识点--float浮动">
      <i class="fa fa-chevron-left"></i> CSS基础知识点--float浮动
    </a></div>
      <div class="post-nav-item">
    <a href="/hexo/2020/08/26/CSS%E5%9F%BA%E7%A1%80%E7%9F%A5%E8%AF%86%E7%82%B9-CSS%E6%A0%B7%E5%BC%8F%E5%91%BD%E5%90%8D/" rel="next" title="CSS基础知识点--CSS样式命名">
      CSS基础知识点--CSS样式命名 <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    
  </article>
  
  
  



          </div>
          

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          Table of Contents
        </li>
        <li class="sidebar-nav-overview">
          Overview
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#%E6%96%87%E5%AD%97%E6%A0%B7%E5%BC%8F%E5%B1%9E%E6%80%A7"><span class="nav-number">1.</span> <span class="nav-text">文字样式属性</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#font-family%E5%AD%97%E4%BD%93%E5%B1%9E%E6%80%A7"><span class="nav-number">2.</span> <span class="nav-text">font-family字体属性</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#font-size%E6%96%87%E5%AD%97%E5%A4%A7%E5%B0%8F"><span class="nav-number">3.</span> <span class="nav-text">font-size文字大小</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#%E7%BB%9D%E5%AF%B9%E5%8D%95%E4%BD%8D"><span class="nav-number">3.1.</span> <span class="nav-text">绝对单位</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E7%9B%B8%E5%AF%B9%E5%8D%95%E4%BD%8D"><span class="nav-number">3.2.</span> <span class="nav-text">相对单位</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#color%E6%96%87%E5%AD%97%E9%A2%9C%E8%89%B2"><span class="nav-number">4.</span> <span class="nav-text">color文字颜色</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#font-weight%E6%96%87%E5%AD%97%E7%B2%97%E7%BB%86"><span class="nav-number">5.</span> <span class="nav-text">font-weight文字粗细</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#font-style%E6%96%87%E5%AD%97%E6%A0%B7%E5%BC%8F"><span class="nav-number">6.</span> <span class="nav-text">font-style文字样式</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#font-variant%E5%AD%97%E4%BD%93%E5%8F%98%E5%BD%A2"><span class="nav-number">7.</span> <span class="nav-text">font-variant字体变形</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#font%E5%B1%9E%E6%80%A7%E7%AE%80%E5%86%99"><span class="nav-number">8.</span> <span class="nav-text">font属性简写</span></a></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="幽辰"
      src="/hexo/images/avatar.jpg">
  <p class="site-author-name" itemprop="name">幽辰</p>
  <div class="site-description" itemprop="description"></div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/hexo/archives/">
        
          <span class="site-state-item-count">127</span>
          <span class="site-state-item-name">posts</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/hexo/categories/">
          
        <span class="site-state-item-count">14</span>
        <span class="site-state-item-name">categories</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/hexo/tags/">
          
        <span class="site-state-item-count">23</span>
        <span class="site-state-item-name">tags</span></a>
      </div>
  </nav>
</div>



      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2021</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">幽辰</span>
</div>
  <div class="powered-by">Powered by <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> & <a href="https://theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Gemini</a>
  </div>

        








      </div>
    </footer>
  </div>

  
  <script src="/hexo/lib/anime.min.js"></script>
  <script src="/hexo/lib/velocity/velocity.min.js"></script>
  <script src="/hexo/lib/velocity/velocity.ui.min.js"></script>

<script src="/hexo/js/utils.js"></script>

<script src="/hexo/js/motion.js"></script>


<script src="/hexo/js/schemes/pisces.js"></script>


<script src="/hexo/js/next-boot.js"></script>




  















  

  

</body>
</html>
